package com.gao.pv;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class Cosumer implements  Runnable {

    @Override
    public void run() {
        while(true){
          while(true){
              Share.lock.lock();
              if(Share.mark){
                  System.out.println("消费者吃包子");
                  Share.mark=false;
                  Share.producer.signal();
              }else{
                  try {
                      Share.consumer.await();
                  } catch (InterruptedException e) {
                      throw new RuntimeException(e);
                  }
              }
              Share.lock.unlock();
          }
        }
    }
}
